package com.luoqian.demo03;

public class Singleton {
    public static Singleton singleton = null;

    public Singleton(){
        if (singleton!=null){
            throw new RuntimeException("坏银，不能通过反射破坏单例！");
        }
    }

    public static Singleton getInstance(){
        if (singleton ==null){
            singleton = new Singleton();
        }
        return singleton;
    }
}
